home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1995 #3 & #4
/
Amiga Plus CD - 1995 - No. 3 and 4.iso
/
pd
/
sound
/
cybersound
/
14bit.driver
/
source
/
driverbase.h
< prev
next >
Wrap
C/C++ Source or Header
|
1995-07-20
|
5KB
|
153 lines
/*****************************************************************************
*
* CyberSound: 14 Bit sound driver
*
* (c) 1995 by Christian Buchner
*
*****************************************************************************
*
* driverbase.h
*/
#include <exec/types.h>
#include <exec/libraries.h>
#include <exec/interrupts.h>
#include <dos/dos.h>
#include <clib/exec_protos.h>
#include <pragmas/exec_pragmas.h>
/*****************************************************************************/
struct DriverBase
{
struct Library db_Lib;
BPTR db_SegList;
struct DosLibrary *db_DOSBase;
struct IntuitionBase *db_IntuitionBase;
struct GfxBase *db_GfxBase;
struct MsgPort *db_AudioReply;
struct IOAudio *db_AudioRequest;
APTR db_OldAudVector0;
APTR db_OldAudVector1;
APTR db_OldAudVector2;
APTR db_OldAudVector3;
struct Interrupt db_AudioVector;
struct Interrupt db_NOPVector;
UWORD *db_ConversionTable;
ULONG db_BUFFER_SIZE;
ULONG db_QUEUE_SIZE;
UBYTE *db_DMABuffer1;
UBYTE *db_DMABuffer2;
struct StreamInfo *db_QueueBuffer;
ULONG db_ProvidePos;
ULONG db_PlayPos;
UWORD db_CurrentBuffer;
UWORD db_LastPeriod;
UWORD db_DriverFlags;
struct Screen *db_CurrentScreen;
ULONG db_CurrentModeID;
UWORD db_CurrentMinPer;
UWORD db_NestLevel;
UBYTE *db_AdditiveArray;
ULONG db_CurrentFormat;
};
/*****************************************************************************/
#define FLGB_PLAYING 0
#define FLGB_NEEDIRQ 1
#define FLGB_FLUSH 2
#define FLGB_PAUSE 3
#define FLGF_NEEDIRQ (1<<FLGB_NEEDIRQ)
#define FLGF_PLAYING (1<<FLGB_PLAYING)
#define FLGF_FLUSH (1<<FLGB_FLUSH)
#define FLGF_PAUSE (1<<FLGB_PAUSE)
/*****************************************************************************/
#define SegList db->db_SegList
#define DOSBase db->db_DOSBase
#define IntuitionBase db->db_IntuitionBase
#define GfxBase db->db_GfxBase
#define AudioReply db->db_AudioReply
#define AudioRequest db->db_AudioRequest
#define OldAudVector0 db->db_OldAudVector0
#define OldAudVector1 db->db_OldAudVector1
#define OldAudVector2 db->db_OldAudVector2
#define OldAudVector3 db->db_OldAudVector3
#define AudioVector db->db_AudioVector
#define NOPVector db->db_NOPVector
#define ConversionTable db->db_ConversionTable
#define BUFFER_SIZE db->db_BUFFER_SIZE
#define QUEUE_SIZE db->db_QUEUE_SIZE
#define DMABuffer1 db->db_DMABuffer1
#define DMABuffer2 db->db_DMABuffer2
#define QueueBuffer db->db_QueueBuffer
#define ProvidePos db->db_ProvidePos
#define PlayPos db->db_PlayPos
#define CurrentBuffer db->db_CurrentBuffer
#define LastPeriod db->db_LastPeriod
#define DriverFlags db->db_DriverFlags
#define CurrentScreen db->db_CurrentScreen
#define CurrentModeID db->db_CurrentModeID
#define CurrentMinPer db->db_CurrentMinPer
#define NestLevel db->db_NestLevel
#define AdditiveArray db->db_AdditiveArray
#define CurrentFormat db->db_CurrentFormat
/*****************************************************************************/
struct StreamInfo
{
UWORD *si_left;
UWORD *si_right;
ULONG si_samples;
UWORD si_interleave;
ULONG si_period;
void (*si_callback)(void);
ULONG si_offset;
};
/*****************************************************************************/
/* Library.c */
struct Library * __asm LibInit ( register __d0 struct DriverBase *db , register __a0 BPTR seglist , register __a6 struct Library *sysbase );
LONG __asm LibOpen ( register __a6 struct DriverBase *db );
LONG __asm LibClose ( register __a6 struct DriverBase *db );
LONG __asm LibExpunge ( register __a6 struct DriverBase *db );
/* Driver.c */
BOOL InitDriver( struct DriverBase *db );
void DeInitDriver( struct DriverBase *db );
BOOL __asm SetBuffers( register __d0 ULONG audiosize, register __d1 ULONG queuesize, register __a6 struct DriverBase *db );
void __asm FreeBuffers( register __a6 struct DriverBase *db );
BOOL __asm StreamFormat( register __d0 ULONG format, register __a6 struct DriverBase *db );
ULONG __asm AskFrequency( register __d0 ULONG frequency, register __a6 struct DriverBase *db );
ULONG __asm AskPeriod( register __d0 ULONG frequency, register __a6 struct DriverBase *db );
BOOL __asm ProvideStream( register __a0 UWORD *left,register __a1 UWORD *right,register __d0 ULONG samples, register __d1 UWORD interleave, register __d2 ULONG frequency,register __a2 void (*callback)(void), register __a6 struct DriverBase *db );
void __asm FlushStream( register __a6 struct DriverBase *db );
void __asm PauseStream( register __a6 struct DriverBase *db );
void __asm ResumeStream( register __a6 struct DriverBase *db );
void __asm AudioInterrupt( register __d1 UWORD ActiveInt,register __a0 struct Custom * custom, register __a1 struct DriverBase *db, register __a6 SysBase );
void __asm StopDMA( register __a6 struct DriverBase *db );
void __asm NOPInterrupt( register __d1 UWORD ActiveInt,register __a0 struct Custom * custom, register __a1 struct DriverBase *db, register __a6 SysBase );
void __asm SD_Lock( register __a6 struct DriverBase *db );
void __asm SD_Unlock( register __a6 struct DriverBase *db );
/* AsmSupport.asm */
void __asm CreateTable(register __a0 UWORD *Table, register __a1 UBYTE *Array);
void __asm ConvertStream(register __a0 UWORD *Stream, register __a1 UBYTE *MSBChannel, register __a2 UBYTE *LSBChannel, register __a3 UWORD *Table, register __d0 ULONG samples, register __d1 UWORD interleave);
void __asm SwapEndian(register __a0 UWORD *Table);